'use strict';
 const db = uniCloud.database();
exports.main = async (event, context) => {
  //event为客户端上传的参数
  let _id=event._id;
  const collection = db.collection('products');
  let res=await collection.doc(_id).get();
  let count=res.data[0].view_count;
  count=parseInt(count)+1;
  res=await collection.doc(_id).update({
	  view_count:count
  });
  console.log('event : ' + event)
  //返回数据给客户端
  return {"status":2}
};